Skip to content

Conversation

@vikrantpuppala
Copy link
Collaborator

Fixes #284

Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
{
url: `${options.https ? 'https' : 'http'}://${options.host}:${options.port}${options.path ?? '/'}`,
url: `${options.https ? 'https' : 'http'}://${options.host.replace(/\/$/, '')}:${options.port}${
options.path ? (options.path.startsWith('/') ? '' : '/') + options.path.replace(/\/$/, '') : '/'
Copy link
Collaborator

@jackyhu-db jackyhu-db Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this (options.path.startsWith('/') ? '' : '/') is redundant

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my thought was that sql warehouses have paths starting with / like /sql/1.0/warehouses/xxxxxx whereas all purpose clusters have paths without a starting / like sql/protocolv1/o/xxxxx/yyyyyy, why do you say this is redundant?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what I meant is you did these twice options.path ? (options.path.startsWith('/') ? '' : '/') + options.path.replace(/\/$/, '') : '/', nvm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(options.path.startsWith('/') ? '' : '/') this would ensure that it has a / at the start and options.path.replace(/\/$/, '') : '/' would ensure that it has a / at the end

@vikrantpuppala vikrantpuppala merged commit 056ed0b into main Apr 14, 2025
7 of 8 checks passed
@vikrantpuppala vikrantpuppala deleted the improve-url-handling branch April 14, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Small Issue : efficient URI formation

4 participants